package com.lkd.handler;

import com.lkd.business.MsgHandler;
import com.lkd.contract.SupplyContract;
import com.lkd.emq.Topic;
import com.lkd.service.ChannelService;
import com.lkd.utils.JsonUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.io.IOException;


@Component
@Topic("server/vms/supply")
public class SupplyContractMsgHandler implements MsgHandler {

    @Autowired
    private ChannelService channelService;


    @Override
    public void process(String jsonMsg) throws IOException {
        //解析消息
        SupplyContract supplyContract = JsonUtil.getByJson(jsonMsg, SupplyContract.class);
        //完成补货逻辑
        channelService.supplyChannel(supplyContract);



    }
}
